/*
 * TNeighborhood.java
 *
 * Created on January 31, 2005, 4:42 PM
 */

package edu.temple.GUS.MMA.Neighborhoods;

/**
 *
 * @author  jeffleon
 */
public class TNeighborhood {
    
    private int t;

    /** Creates a new instance of TNeighborhood */
    public TNeighborhood(int t) {this.t = t;}
    
    public int getT () { return t; }
    
    public void putT () { this.t = t; }
    
    // Return the position of the center of the neighborhood
    // where the index of the first element is assumed to be zero
    public TCoordinate getCenter()
    {
        TCoordinate coordinate = new TCoordinate();
        
        // Even number of units
        if (t%2 == 0)
            coordinate.putT((t/2));
        else
        // Odd number of units
            coordinate.putT((t/2 - 1));

        return coordinate;
    }
    
    // Return the lower boundary of the neighborhood
    // assuming the position of the center is zero
    public int getLowerBoundary()
    {
        return -t/2;    
    }

    // Return the upper boundary of the neighborhood
    // assuming the position of the center is zero
    public int getUpperBoundary()
    {
        // Even number of units
        if (t%2 == 0)
            return t/2 - 1;
        else
            return t/2;    
    }
}
